package com.yloveg.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yloveg.dao.SRoleMapper;
import com.yloveg.dao.VGiftMapper;
import com.yloveg.entity.SRole;
import com.yloveg.entity.VGift;
import com.yloveg.service.SRoleService;
import com.yloveg.service.VGiftService;

@Service
public class VGiftServiceImpl implements VGiftService {

	@Autowired
    private VGiftMapper vGiftMapper;
	  
	@Override
	public PageInfo<VGift> queryGiftPage(int page, int limit) {
		PageHelper.startPage(page, limit);
		List<VGift> vGiftList = vGiftMapper.queryVGift();
		PageInfo<VGift> resultPage=new PageInfo<VGift>(vGiftList);
		return resultPage;
	}

	@Override
	public int insertGift(VGift vgift) {
		vgift.setCreateTime(new Date());
		vgift.setSts("Y");
		return vGiftMapper.insert(vgift);
	}

	@Override
	public int updateByPrimaryKeySelective(VGift vgift) {
		vgift.setUpdateTime(new Date());
		return vGiftMapper.updateByPrimaryKeySelective(vgift);
	}

	@Override
	public VGift selectByPrimaryKey(Integer id) {
		return vGiftMapper.selectByPrimaryKey(id);
	}

	@Override
	public int delGift(Integer id) {
		return vGiftMapper.deleteByPrimaryKey(id);
		
	}

	@Override
	public List<Map<String, Object>> queryGiftMap(VGift vgift) {
		
		return null;
	}

	@Override
	public List<VGift> queryGift() {
		List<VGift> vGiftList = vGiftMapper.queryVGift();
		return vGiftList;
	}

}
